<template>

	<div>
		<el-form :inline="true">
			<el-form-item label="">
				<el-button type="primary" :icon="Refresh" @click="selectAll()"></el-button>
			</el-form-item>
			<el-form-item label="">
				<el-button type="primary" :icon="Plus" @click="handleSave()">新建</el-button>
				
				<!-- <QueryCondition @click="handleSave"> -->
					 <!-- 添加 -->
					 <!-- <template #default>
						 <el-form-item label="名">
							 <el-input placeholder="11"></el-input>
						 </el-form-item>
					 </template>
				 </QueryCondition> -->
				 
			</el-form-item>
			<el-form-item label="类型" style="width: 200px;">
				<el-select v-model="form.category">
					<el-option value="全部">全部</el-option>
				</el-select>
			</el-form-item>
			<el-form-item label="物资状态" style="width: 200px;">
				<el-select v-model="form.materialStatus">
					<el-option value="全部">全部</el-option>
					<el-option value="有效" label="有效">有效</el-option>
					<el-option value="无效" label="无效">无效</el-option>
				</el-select>
			</el-form-item>
			<el-form-item label="">
				<el-input v-model="form.name" placeholder="名称/拼音"></el-input>
			</el-form-item>
			<el-form-item label="">
				<el-button type="primary" :icon="Search" @click="selectList()"></el-button>
			</el-form-item>
		</el-form>

		<el-table :data="dataList">
			<el-table-column prop="id" label=""></el-table-column>
			<el-table-column prop="materialName" label="物资名称"></el-table-column>
			<el-table-column prop="healthInsurance" label="国家医保码" width="95px"></el-table-column>
			<el-table-column prop="category" label="类别"></el-table-column>
			<el-table-column prop="brand" label="品牌"></el-table-column>
			<el-table-column prop="typeSpecification" label="型号规格"></el-table-column>
			<el-table-column prop="minUnits" label="最小单位"></el-table-column>
			<el-table-column prop="manufacturer" label="生产商"></el-table-column>
			<el-table-column prop="valid" label="有效">
				<template #default="scope">
					<el-switch v-model="scope.row.valid" inline-prompt active-text="0" inactive-text="1" />
				</template> <!-- active-value    true-value="1-->
			</el-table-column>
			<el-table-column prop="admin" label="创建人"></el-table-column>
			<el-table-column prop="saveUpdate" label="创建时间"></el-table-column>
			<el-table-column prop="" label="操作" width="160" fixed="right">
				<template #default="scope">
					<el-button type="success" @click="handleEdit(scope.$index,scope.row)">修改</el-button>
					<el-button type="danger" @click="handleDelete(scope.$index,scope.row)">删除</el-button>
				</template>
			</el-table-column>
		</el-table>
	</div>
	
	<el-pagination v-model:current-page="form.current" v-model:page-size="form.size" :total="total"
		:page-sizes="[10, 20, 30, 40]" @size-change="chandleSizeChange" @current-change="handleCurrentChange"
		layout="total, sizes, prev, pager, next, jumper">
	</el-pagination>

	<MaterialsSaveOrUpdate v-model="visible" ref="saveOrUpdate"></MaterialsSaveOrUpdate>
</template>

<script setup lang="ts">
	import {onMounted} from 'vue';
	import { Plus, Refresh, Search } from "@element-plus/icons-vue";
	import MaterialsSaveOrUpdate from '../materials/MaterialsSaveOrUpdate.vue';
	import { useselectPage } from '../../../common/common';
	import QueryCondition from '../../../common/QueryCondition.vue';
	const { form, dataList, total, selectUrl, deleteUrl, visible, selectList, handleEdit, handleSave, handleDelete, chandleSizeChange,
		handleCurrentChange, selectAll } = useselectPage(MaterialsSaveOrUpdate);

	selectUrl.value = '/student/login';
	deleteUrl.value = '';
	
	onMounted(() => {
		selectList();
	});
</script>

<style>
</style>